﻿/***********************************************************************
 * <copyright file="EnumHelper.cs" company="BSD JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Thursday, April 24, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System;
using System.ComponentModel;
using System.Reflection;

namespace DxMvcApplication.Code
{
    public static class EnumHelper
    {
        public enum IconEnum
        {
            [Description("iconCls:'icon-ok'")]
            IconOk,
            [Description("iconCls:'icon-cancel'")]
            IconCancel,
            [Description("iconCls:'icon-help'")]
            IconHelp,
            [Description("iconCls:'icon-search'")]
            IconSearch
        }

        public enum AlignEnum
        {
            [Description("")]
            Default,
            [Description("left'")]
            Left,
            [Description("right")]
            Right,
            [Description("center")]
            Center
        }
        
        public enum EnumPosition
        {
            [Description("top")]
            Top,
            [Description("bottom'")]
            Bottom,
            [Description("left")]
            Left,
            [Description("right")]
            Right
        }

        public enum FormatNumber
        {
            [Description("top")]
            Top,
            [Description("bottom'")]
            Bottom,
            [Description("left")]
            Left,
            [Description("right")]
            Right
        }

        public enum CurrencySymbolPosition
        {
            Left = 0,
            Right = 1
        }
        public enum StatusType
        {
            [Description("Kích Hoạt")]
            Active=1,
            [Description("Khóa")]
            Lock=0
        }
        public enum AccessType
        {
            [Description("ReadOnly")]
            ReadOnly = 0,
            [Description("FullControl")]
            FullControl = 1
        }
        public static string GetEnumDescription(Enum value)
        {
            FieldInfo fi = value.GetType().GetField(value.ToString());
            var attributes =(DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
            return attributes.Length > 0 ? attributes[0].Description : value.ToString();
        }
    }

}
